/*
*  Copyright (C) 2009  Peter Kist & Jan Ripke
*
*  This program is free software: you can redistribute it and/or modify
*  it under the terms of the GNU General Public License as published by
*  the Free Software Foundation, either version 3 of the License, or
*  (at your option) any later version.
*
*  This program is distributed in the hope that it will be useful,
*  but WITHOUT ANY WARRANTY; without even the implied warranty of
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
*  GNU General Public License for more details.
*
*  You should have received a copy of the GNU General Public License
*  along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

#pragma once

namespace galaxy {
    namespace core {

            /** The Point class template represents a point in 3d space */
            template<typename T>
            class Point {
            public:
                T x, y, z;

                Point () : x(T(0)), y(T(0)), z(T(0)) { };
                Point (Point& p) : x(p.x), y(p.y), z(p.z) { };
                Point (T _x, T _y, T _z) : x(_x), y(_y), z(_z) { };

                Point<T>& operator= (Point<T>& p) { x = p.x; y = p.y; z = p.z; return *this; };
            };

            /** The Vector class template represents a vector in 3d space */
            template<typename T>
            class Vector: public Point<T> 
            {
            public:

                Vector () { };
                Vector (Vector& v) : Point(v) { };
                Vector (T _x, T _y, T _z) : Point(_x,_y,_z) { };

                Vector<T>& operator= (Vector<T>& vec) { this->Point::operator=(vec); return *this; };
                /** Add value \b val to the x, y and z component of the vector */
                Vector<T> operator+ (T val) { 
                    Vector<T> v(*this); 
                    v.x += val; 
                    v.y += val; 
                    v.z += val; 
                    return v; 
                };
            };

            /** The BoundingBox class template represents a cube in 3d space */
            template<typename T>
            class BoundingBox {
            public:
                Vector<T> m_Min, m_Max;

                BoundingBox () { };
                BoundingBox (BoundingBox& box) : m_Min (box.m_Min), m_Max (box.m_Max) { };
                BoundingBox (T& mx, T& my, T& mz, T& Mx, T& My, T& Mz)
                    : m_Min (mx, my, mz), m_Max (Mx, My, Mz)
                {
                }

                BoundingBox& operator= (BoundingBox& box) { m_Min = box.m_Min; m_Max = box.m_Max; return *this };
            };

    } // namespace core
} // namespace galaxy
